package demo.service;

import demo.dao.AccountDao;
import demo.model.Account;
import demo.utils.JdbcPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: zigang.wang
 * Date: 12-3-19
 * Time: 上午10:50
 * To change this template use File | Settings | File Templates.
 */
@Service
public class AccountService {
    @Autowired
    AccountDao accountDao;

    public JdbcPage<Account> listAccount(int curPage, int pageSize, int status) {
        return accountDao.listAccount(curPage, pageSize, status);
    }

    /**
     *
     * @param account
     * @return Id
     */
    public long create(Account account) {
        return (Long) accountDao.create(account);
    }

    public void update(Account account) {
        accountDao.update(account);
    }

    public Account getById(long id) {
        return accountDao.get(id);
    }
}
